/*****************************************************************************************************************
Class Name: NMR Utility Class
* Author: Accenture
* Date: 01-March-2012 
* Requirement/Project Name: NMR 
* Requirement Description: For referential purpose in NMRDoNotCallLeadUpdate and NMRLeadDoNotCallCreateUpdate.
*********************************************************************************************************************/
public class NMRUtil{
    public static Set<Id> processed = new Set<Id>();
    
    /**
    * Method which returns true if the argument is null or its length is 0
    */
    public static Boolean isEmpty(String str){
        return (str == null || str.trim().length() <= 0) ? true :false ;
    }
    
    /**
    * Method to format the argument (mainly phone).
    * Argument format - XXXXXXXXXX
    * Return Field format - (XXX) XXX-XXXX
    */
    public static String formatPhone(String cleanPhone){
        if(!NMRUtil.isEmpty(cleanPhone)){
            if (cleanPhone.startsWith('('))
                return cleanPhone; //no need to format
            else{
                String npa = cleanPhone.substring(0,3);
                String nxx = cleanPhone.substring(3,6);
                String line = cleanPhone.substring(6,10);
                
                return '(' + npa + ') ' + nxx + '-' + line;
            }
         }else
             return '';
           
    }
     
}